< -package:ghc-lib-parser package:classy-prelude

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version. Using ApplicativeDo: 'a <$ bs' can be understood as the do expression
do bs
pure a
with an inferred Functor constraint.
An infix synonym for fmap. The name of this operator is an allusion to $. Note the similarities between their types:
($)  ::              (a -> b) ->   a ->   b
(<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $ is function application, <$> is function application lifted over a Functor.

Examples

Convert from a Maybe Int to a Maybe String using show:
>>> show <$> Nothing
Nothing

>>> show <$> Just 3
Just "3"
Convert from an Either Int Int to an Either Int String using show:
>>> show <$> Left 17
Left 17

>>> show <$> Right 17
Right "17"
Double each element of a list:
>>> (*2) <$> [1,2,3]
[2,4,6]
Apply even to the second element of a pair:
>>> even <$> (2,2)
(2,True)
&& lifted to an Applicative.
Sequence actions, discarding the value of the second argument. Using ApplicativeDo: 'as <* bs' can be understood as the do expression
do a <- as
bs
pure a
A variant of <*> with the arguments reversed. Using ApplicativeDo: 'as <**> fs' can be understood as the do expression
do a <- as
f <- fs
pure (f a)
Sequential application. A few functors support an implementation of <*> that is more efficient than the default one. Using ApplicativeDo: 'fs <*> as' can be understood as the do expression
do f <- fs
a <- as
pure (f a)
Add an extension, even if there is already one there, equivalent to addExtension.
"/directory/path" <.> "ext" == "/directory/path.ext"
"/directory/path" <.> ".ext" == "/directory/path.ext"
Combine two paths with a path separator. If the second path starts with a path separator or a drive letter, then it returns the second. The intention is that readFile (dir </> file) will access the same file as setCurrentDirectory dir; readFile file.
Posix:   "/directory" </> "file.ext" == "/directory/file.ext"
Windows: "/directory" </> "file.ext" == "/directory\\file.ext"
"directory" </> "/file.ext" == "/file.ext"
Valid x => (takeDirectory x </> takeFileName x) `equalFilePath` x
Combined:
Posix:   "/" </> "test" == "/test"
Posix:   "home" </> "bob" == "home/bob"
Posix:   "x:" </> "foo" == "x:/foo"
Windows: "C:\\foo" </> "bar" == "C:\\foo\\bar"
Windows: "home" </> "bob" == "home\\bob"
Not combined:
Posix:   "home" </> "/bob" == "/bob"
Windows: "home" </> "C:\\bob" == "C:\\bob"
Not combined (tricky): On Windows, if a filepath starts with a single slash, it is relative to the root of the current drive. In [1], this is (confusingly) referred to as an absolute path. The current behavior of </> is to never combine these forms.
Windows: "home" </> "/bob" == "/bob"
Windows: "home" </> "\\bob" == "\\bob"
Windows: "C:\\home" </> "\\bob" == "\\bob"
On Windows, from [1]: "If a file name begins with only a disk designator but not the backslash after the colon, it is interpreted as a relative path to the current directory on the drive with the specified letter." The current behavior of </> is to never combine these forms.
Windows: "D:\\foo" </> "C:bar" == "C:bar"
Windows: "C:\\foo" </> "C:bar" == "C:bar"
Right-to-left composition of Kleisli arrows. (>=>), with the arguments flipped. Note how this operator resembles function composition (.):
(.)   ::            (b ->   c) -> (a ->   b) -> a ->   c
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
An associative operation.
>>> [1,2,3] <> [4,5,6]
[1,2,3,4,5,6]
An associative binary operation
|| lifted to an Applicative.
Same as >>=, but with the arguments interchanged.